//
//  MainTabViewController.m
//  HappySporting
//
//  Created by 康康 on 16/6/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MainTabViewController.h"
#import "UserViewController.h"
#import "MoveYourBodyViewController.h"
#import "SportsMusicViewController.h"

@interface MainTabViewController ()

@end

@implementation MainTabViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
//    UserViewController *userVC = [[UserViewController alloc]init];
//    UINavigationController *userNaVC = [[UINavigationController alloc]initWithRootViewController:userVC];
//    [userVC release];
//    
//    userNaVC.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"我的" image:[[UIImage imageNamed:@"tabBar_me_icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[UIImage imageNamed:@"tabBar_me_click_icon"]];
    /*添加子控制器*/
    /**我的*/
    [self setUpChildControllerWith:[[UserViewController alloc] init] norImage:[UIImage imageNamed:@"tabBar_me_icon"] selImage:[UIImage imageNamed:@"tabBar_me_click_icon"] title:@"我的"];
    /**动听*/
    [self setUpChildControllerWith:[[SportsMusicViewController alloc] init] norImage:[UIImage imageNamed:@"tabBar_me_icon"] selImage:[UIImage imageNamed:@"tabBar_me_click_icon"] title:@"动听"];
    
    /**运动起来*/
    [self setUpChildControllerWith:[[MoveYourBodyViewController alloc] init] norImage:[UIImage imageNamed:@"tabBar_me_icon"] selImage:[UIImage imageNamed:@"tabBar_me_click_icon"] title:@"运动起来"];
    
}


//自定义一个方法
- (void)setUpChildControllerWith:(UIViewController *)childVc norImage:(UIImage *)norImage selImage:(UIImage *)selImage title:(NSString *)title
{
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:childVc];
    nav.navigationBar.barTintColor = [UIColor blackColor];
    nav.navigationController.navigationBar.translucent = NO;
    [childVc release];
    
   // childVc.title = title;
    
    childVc.tabBarItem.image = norImage;
    childVc.tabBarItem.selectedImage = selImage;
    
    [self addChildViewController:nav];
    
    [nav release];
    
}




@end
